package com.ljx.funchat.chat.dao;

import com.ljx.funchat.chat.domain.entity.Room;
import com.ljx.funchat.chat.mapper.RoomMapper;
import com.ljx.funchat.chat.service.IRoomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiJunXi
 * @since 2024-02-14
 */
@Service
public class RoomDao extends ServiceImpl<RoomMapper, Room> {

    public void refreshActiveTime(Long roomId, Long messageId, Date updateTime) {
        lambdaUpdate().eq(Room::getId, roomId)
                .set(Room::getActiveTime, updateTime)
                .set(Room::getLastMsgId, messageId)
                .update();
    }
}
